package com.gxa.autoparts.admin.service.impl;

import com.gxa.autoparts.admin.mapper.AdviceMapper;
import com.gxa.autoparts.admin.service.AdviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author Bei
 * @date 2022/1/6 11:30
 */
@Service
@Transactional(rollbackFor = Throwable.class)
public class AdviceServiceImpl implements AdviceService {

    @Autowired
    AdviceMapper adviceMapper;


    @Override
    public List<Map> selectByLike(String phone, String name, String startTime, String endTime, Integer page, Integer size) {
        List<Map> maps = adviceMapper.selectByLike(phone, name, startTime, endTime, (page - 1) * size, size);
        return maps;
}

    @Override
    public Integer count(String phone, String name, String startTime, String endTime, Integer page, Integer size) {
        List<Map> maps =  adviceMapper.selectByLike(phone, name, startTime, endTime, null, null);
        int size1 = maps.size();
        return size1;
    }

    @Override
    public void updateAdvice(Long id, String remark) {
        adviceMapper.updateAdvice(id,remark);
    }


}
